package aop_ex;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

import org.springframework.core.io.Resource;

public class Main {
	public static void main(String[] args) {
		Resource rs = new ClassPathResource("aop_ex/beans.xml");
		BeanFactory factory = new XmlBeanFactory(rs);// 맨바탕

		System.out.println("Board시작");
		System.out
				.println("Around Advice call ------------------------------------------------");
		Data bean = (Data) factory.getBean("proxy");
		bean.insert("시작");

		System.out.println();
		// Around Advice call
		System.out
				.println("Before Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyBefore");
		bean.insert("중간");

		System.out.println();
		// After Advice call
		System.out
				.println("After Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyAfter");
		bean.insert("끝");
	
		System.out.println("Board끝");
		System.out.println();
		
		System.out.println("Member 시작");
		System.out
				.println("Around Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxym");
		bean.insert("시작");

		System.out.println();
		// Around Advice call
		System.out
				.println("Before Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyBeforem");
		bean.insert("중간");

		System.out.println();
		// After Advice call
		System.out
				.println("After Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyAfterm");
		bean.insert("끝");
		System.out.println("Member 끝");
		System.out.println();
		
		System.out.println("QnA 시작");
		System.out
				.println("Around Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyq");
		bean.insert("시작");

		System.out.println();
		// Around Advice call
		System.out
				.println("Before Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyBeforeq");
		bean.insert("중간");

		System.out.println();
		// After Advice call
		System.out
				.println("After Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyAfterq");
		bean.insert("끝");
		System.out.println("QnA 끝");
		System.out.println();
		
		System.out.println("Notice시작");
		System.out
				.println("Around Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyn");
		bean.insert("시작");

		System.out.println();
		// Around Advice call
		System.out
				.println("Before Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyBeforen");
		bean.insert("중간");

		System.out.println();
		// After Advice call
		System.out
				.println("After Advice call ------------------------------------------------");
		bean = (Data) factory.getBean("proxyAftern");
		bean.insert("끝");
	
		System.out.println("Notice끝");
		System.out.println();
	}
}